package tiltmaze.solver;

import tiltmaze.RowCol;

/**
 * A vertex of a motion graph.
 * @author Juraj Nižnan
 */
public class Vertex {

    RowCol position;
    Vertex[] targets;
    int[] edges;

    public Vertex() {
        edges = new int[4];
        targets = new Vertex[4];
    }

    public Vertex(RowCol position) {
        this();
        this.position = position;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Vertex other = (Vertex) obj;
        if (this.position != other.position && (this.position == null || !this.position.equals(other.position))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 19 * hash + (this.position != null ? this.position.hashCode() : 0);
        return hash;
    }
}
